package com.duoketech.model.roomorder;
import com.duoketech.model.AbstractModel;
import com.duoketech.utils.PageUtil;

public class RoomOrder extends AbstractModel<RoomOrder>{
    public static final RoomOrder dao = new RoomOrder();

    public static final int STATUS_UNPAY=0;
    public static final int STATUS_PAID=1;
    public static final int STATUS_IN=2;
    public static final int STATUS_CHECKOUT=3;
    public static final int STATUS_CANCEL=4;

    public static final int CARD_TYPE_IDENTIFY=1;
    public static final int CARD_TYPE_PASSPORT=2;
    public static final int CARD_TYPE_HK_TW=1;



    public static final String ID = "id";//
    public static final String NAME = "name";//入驻人
    public static final String MOBILE = "mobile";//入驻人手机
    public static final String START_TIME = "start_time";//入驻时间
    public static final String END_TIME = "end_time";//离开时间
    public static final String OBJ_ID = "obj_id";//客栈类型
    public static final String REMARKER = "remarker";//备注信息
    public static final String PRICE = "price";//价格
    public static final String TOTAL_PRICE = "total_price";//总价格
    public static final String MEMBER_ID = "member_id";//memberId
    public static final String CARD_NO = "card_no";//memberId
    public static final String CARD_TYPE = "card_type";//memberId
    public static final String UNIT_ID = "unit_id";//memberId
    public static final String ORDER_SN = "order_sn";//memberId
    @Override
    public String tableName() {
        return "t_order_room";
    }

    @Override
    public String status() {
        return statusConvert(getInt(STATUS));
    }


    public String statusConvert(int code){
        String result="未知";
        if(code==STATUS_NORMAL){
            result="等待支付";
        }else if(code==STATUS_PAID){
            result="已支付";
        }else if(code==STATUS_IN){
            result="已入住";
        }else if(code==STATUS_CHECKOUT){
            result="已退房";
        }else if(code==STATUS_CANCEL){
            result="取消入住";
        }
        return result;
    }

    public String startTime(){
        return PageUtil.formatDataYYMMDD(getDate(START_TIME));
    }

    public String endTime(){
        return PageUtil.formatDataYYMMDD(getDate(END_TIME));
    }

    public String price(){
        return PageUtil.fengToYuan(getInt(PRICE))+"";
    }
    public String totalPrice(){
        return PageUtil.fengToYuan(getInt(TOTAL_PRICE))+"";
    }

    public String cardType(){
        String result="未知";
        if(getInt(CARD_TYPE)==CARD_TYPE_IDENTIFY){
            result="身份证";
        } else if(getInt(CARD_TYPE)==CARD_TYPE_PASSPORT){
            result=" 护照";
        }else if(getInt(CARD_TYPE)== CARD_TYPE_HK_TW){
            result="台胞证";
        }
        return result;
    }
}